package hong.jun.time;

/**
 * @ClassName SingleObject
 * @Description TODO
 * @Author hongjun
 * @Date 2023/10/31 12:00
 * @Version 1.0
 */
public class SingleObject {
    /**
     * 用枚举来实现单例
     */
    private enum Singleton {
        INSTANCE;
        SingleObject processor;

        Singleton() {
            this.processor = new SingleObject();
        }

        SingleObject getProcessor() {
            return processor;
        }
    }


    /**
     * 获取实例对象
     *
     * @return
     */
    public static SingleObject getInstance() {
        return SingleObject.Singleton.INSTANCE.getProcessor();
    }
}
